package valeria;

import java.util.Scanner;

public class J15Ch05Calculator {
	
	public static void main(String[]args){
		String msg="두 정수와 연산자를 입력하세요.";
		Scanner sc= new Scanner(System.in);
		//new 연산자를 이용한 객체생성은 최대한 천천히 실행할것. 
		J15Add add=null;
		J15Sub sub=null;
		J15Mul mul=null;
		J15Div div=null;
		
		System.out.println(msg);
		int a =sc.nextInt();
		int b =sc.nextInt();
		String c =sc.next();
		
		switch(c){
		case"+":add=new J15Add();
		add.setValue(a,b);
		System.out.println(add.calculate());
		break;
		case"-":sub=new J15Sub();
		sub.setValue(a,b);
		System.out.println(sub.calculate());
		break;
		case"*":mul=new J15Mul();
		mul.setValue(a, b);
		System.out.println(mul.calculate());
		break;
		case"/":div=new J15Div();
		div.setValue(a,b);
		System.out.println(div.calculate());
		break;}
	
		
	
	
	}
}
